using System;
using UnityEngine;
using UnityEngine.SceneManagement;
using Voodoo.Pattern;

public class EditDrawingButton : MonoBehaviour
{
	[SerializeField]
	private GameObject EditLevelBtn;

	private void Start()
	{
		if (Preloader.DrawYourOwnLevel.IsEnabled && SingletonMB<GameManager>.Instance.Currentlevel > 0)
		{
			EditLevelBtn.SetActive(value: true);
			GameManager instance = SingletonMB<GameManager>.Instance;
			instance.OnGameStart = (Action)Delegate.Combine(instance.OnGameStart, new Action(OnGameStart));
			GameManager instance2 = SingletonMB<GameManager>.Instance;
			instance2.OnGameEnd = (Action)Delegate.Combine(instance2.OnGameEnd, new Action(OnGameEnd));
		}
	}

	private void OnDestroy()
	{
		if ((bool)SingletonMB<GameManager>.Instance)
		{
			GameManager instance = SingletonMB<GameManager>.Instance;
			instance.OnGameStart = (Action)Delegate.Remove(instance.OnGameStart, new Action(OnGameStart));
			GameManager instance2 = SingletonMB<GameManager>.Instance;
			instance2.OnGameEnd = (Action)Delegate.Remove(instance2.OnGameEnd, new Action(OnGameEnd));
		}
	}

	private void OnGameStart()
	{
		base.gameObject.SetActive(value: false);
	}

	private void OnGameEnd()
	{
		base.gameObject.SetActive(value: true);
	}

	public void OnEditLevel()
	{
		SceneManager.LoadScene("Drawing");
	}
}
